Page({
  data: {
    name:'',
    age:'',
    number:'',
    address:'',
    user:'',
    phone:'',
    datatrue:'',
    first:'',
    once:'',
    now:'',
    other:'',
    one:'第一次',
    two:'第二次',
    three:'第三次',
    four:'第四次',
    ones:'第一次',
    twos:'第二次',
    threes:'第三次',
    fours:'第四次',
    bloodOne:"",
    bloodTwo:"",
    bloodThree:"",
    bloodFour:"",
    blood:'',
    injection:'注射药物名称',
    oral:'口服药物名称',
    bindTextAreaBlur:'',
    nowother:'',
    others:'',
    value:'',
    values:'',
    drugs:'',
    symptoms:'',
    items:'',
    reaction:'',
    glycopenia:'',
    id:''
  },
  onLoad: function (options) {
    this.setData({
      id:options.id
    })
    this.getData()
  },
  getData() {
    wx.request({
      url: 'https://baojian.dobest.site/index.php?s=/api/Archives/archivesDetail&wxapp_id=10001&token='+wx.getStorageSync("token"),
      method:'GET',
      data: {
        id:this.data.id
      },
      success: res => {
        console.log(res.data.data)
        this.setData({
          name:res.data.data.name,
          age:res.data.data.age,
          number:res.data.data.number,
          address:res.data.data.address,
          phone:res.data.data.phone,
          user:res.data.data.contacts,
          datatrue:res.data.data.confirm_ill,
          first:res.data.data.first_use,
          once:res.data.data.once_yds_name,
          now:res.data.data.now_yds_name,
          bindTextAreaBlur:res.data.data.complication,
          one:res.data.data.blood_pressure_one,
          two:res.data.data.blood_pressure_two,
          three:res.data.data.blood_pressure_three,
          four:res.data.data.blood_pressure_four,
          ones:res.data.data.weight_one,
          twos:res.data.data.weight_two,
          threes:res.data.data.weight_three,
          fours:res.data.data.weight_four,
          bloodOne:res.data.data.fasting+"mmol/L",
          bloodTwo:res.data.data.after_dinner+"mmol/L",
          bloodThree:res.data.data.random+"mmol/L",
          bloodFour:res.data.data.tolerance+"mmol/L",
          other:res.data.data.others,
          blood:res.data.data.other_examinations,
          oral:res.data.data.oral_administration,
          injection:res.data.data.injection,
          nowother:res.data.data.other_medicine,
          others:res.data.data.final_other,
          symptoms:res.data.data.symptom
        })
        if(res.data.data.is_first_use==1){
          this.setData({
            items:'是',
          })
        }
        else if(res.data.data.is_first_use==2){
          this.setData({
            reaction:'否',
          })
        }
        if(res.data.data.adverse_reactions==1){
          this.setData({
            reaction:'是',
          })
        }
        else if(res.data.data.adverse_reactions==2){
          this.setData({
            items:'否',
          })
        }
        if(res.data.data.hypoglycemia==1){
          this.setData({
            glycopenia:'偶尔',
          })
        }
        else if(res.data.data.hypoglycemia==2){
          this.setData({
            glycopenia:'经常',
          })
        }
        else if(res.data.data.hypoglycemia==3){
          this.setData({
            glycopenia:'无',
          })
        }
      },
      fail: err => {
        console.log(err)
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  },
  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  },
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  }
})